import { createRouter, createWebHashHistory, RouteRecordRaw, Router } from 'vue-router'

const Layout = () => import('@/layout/index.vue')



const routers:RouteRecordRaw[] = [

  {
    path: '/',
    component: Layout,
    name: 'Root',
    redirect: '/test',
    children: [
      {
        path: '/test',
        component: () => import('@/views/table-test.vue'),
        name: 'test',
        meta: {
          hidden: true,
          canTo: true
        }
      },
      {
        path: '/test1',
        component: () => import('@/views/test1.vue'),
        name: 'test1',
        meta: {
          hidden: true,
          canTo: true
        }
      },
      {
        path: '/test2',
        component: () => import('@/views/test2.vue'),
        name: 'test2',
        meta: {
          hidden: true,
          canTo: true
        }
      },
      {
        path: '/system/menu',
        component: () => import('@/views/System/Menu/index.vue'),
        name: 'menu',
        meta: {
          hidden: true,
          canTo: true
        }
      },
      {
        path: '/system/permission',
        component: () => import('@/views/System/Permission/index.vue'),
        name: 'perms',
        meta: {
          hidden: true,
          canTo: true
        }
      },
      {
        path: '/system/dict',
        component: () => import('@/views/System/Dict/Dict.vue'),
        name: 'dict',
        meta: {
          hidden: true,
          canTo: true
        }
      }
    ]
  },

]

const commonRouters:RouteRecordRaw[] = [
  {
    path: '/login',
    component: () => import('@/views/Login/index.vue'),
    name: 'login',
    meta: {
      hidden: true,
      canTo: true
    }
  },
]


const allRouters:RouteRecordRaw[] = [...routers, ...commonRouters]

export const router = createRouter({
  history: createWebHashHistory(),
  strict: true,
  routes: allRouters,
  scrollBehavior: () => ({ left: 0, top: 0 })
})
